#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h> 
#include <stdlib.h> 
#include <string.h> 
#include <math.h> 
#include <ctype.h> 
#include <time.h> 
#include <assert.h>

int main()
{
	int num = 0;
	int wei = 0;
	int arr[5] = { 0 };
	int i = 0;
	scanf("%d", &num);

	do
	{
		wei++;
		arr[i] = num % 10;
		i++;
		num /= 10;

	} while (num != 0);

	printf("%d\n", wei);

	for (int i = wei - 1; i >= 0; i--)
	{
		printf("%d ", arr[i]);
	}
	printf("\n");

	for (int i = 0; i <wei; i++)
	{
		printf("%d", arr[i]);
	}
	printf("\n");

	return 0;
}